Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pynipap to single file #1396

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

garberg
Copy link
Member

@garberg garberg commented Aug 14, 2024

To avoid hogging the global name "tracing", merged tracing.py into pynipap.py.

pynipap is a bit of a beast and really should be split up in smaller files in a python package, but I'll leave that for another day...

To avoid hogging the global name "tracing", merged tracing.py into
pynipap.py.
current_span.set_attribute("net.peer.transport", "ip_tcp")
connection.putheader("traceparent",
"00-" + hex(current_span.get_span_context().trace_id)[2:].zfill(32) + "-" + hex(
current_span.get_span_context().span_id)[2:].zfill(16) + "-0" + ("1" if current_span.is_recording() else "0"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (151 > 79 characters)

current_span.set_attribute("net.peer.port", connection.port)
current_span.set_attribute("net.peer.transport", "ip_tcp")
connection.putheader("traceparent",
"00-" + hex(current_span.get_span_context().trace_id)[2:].zfill(32) + "-" + hex(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (117 > 79 characters)

result = super().request(host, handler, request_body, verbose)
current_span.set_attribute("http.status_code", 200)
except xmlrpclib.ProtocolError as protocolError:
current_span.set_attribute("http.status_code", protocolError.errcode)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

with tracer.start_as_current_span("POST XML request", context.get_current(), SpanKind.CLIENT):
current_span = trace.get_current_span()
try:
result = super().request(host, handler, request_body, verbose)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (82 > 79 characters)

headers=headers, context=context)

def request(self, host, handler, request_body, verbose=False):
with tracer.start_as_current_span("POST XML request", context.get_current(), SpanKind.CLIENT):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (106 > 79 characters)

return decorated


class TracingXMLTransport(xmlrpclib.Transport):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (2)

index += 1
try:
span.set_attribute("username", AuthOptions().options['username'])
span.set_attribute("authoritative_source", AuthOptions().options['authoritative_source'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (109 > 79 characters)

break
index += 1
try:
span.set_attribute("username", AuthOptions().options['username'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (85 > 79 characters)

for parameter in signature.parameters:
if index > 0:
try:
span.set_attribute("argument." + parameter, str(args[index]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

trace.set_tracer_provider(provider)


def create_span(f):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (2)

processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=endpoint))
else:
processor = BatchSpanProcessor(
opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter(endpoint=endpoint))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (106 > 79 characters)

tracer = trace.get_tracer("pynipap")


def init_tracing(service_name, endpoint, sampler, use_grpc=True):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (2)

try:
from opentelemetry import trace, context
from opentelemetry.trace import SpanKind, INVALID_SPAN
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (86 > 79 characters)

@@ -17,7 +17,7 @@
author_email = pynipap.__author_email__,
license = pynipap.__license__,
url = pynipap.__url__,
py_modules = ['pynipap','tracing'],
py_modules = ['pynipap'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected spaces around keyword / parameter equals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants